package com.jack.configuration;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

@Component
public class CustomUserDetail implements UserDetailsService{

	@Override
	public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
		if("user".equals(userName)){
			return new SecurityUser("user", "password1", "user-role");
		}else if("admin".equals(userName)){
			return new SecurityUser("admin", "password2", "user-admin");
		}else{
			return null;
		}
	}
	
}
